<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

<!DOCTYPE html>
<html lang="zh-CN"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.js"></script>
</head>
<body class="body">
	<jsp:include page="include/head.jsp">
		<jsp:param value="${ep}" name="ep"/>
	</jsp:include>
	
	
	<div class="container">
	  <div class="row">
		<div class="span3">
			<div style="padding: 8px 0;" class="well">
				<jsp:include page="include/nav.jsp">
					<jsp:param value="${ep}" name="ep"/>
				</jsp:include>
			</div>
		</div>
		<div class="span6">
		  
		  	<ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;">
				<li class="active">
					<i class="icon-th"></i>你在想什么？
				</li>
			</ul>
			<div class="wall">
				<form style="margin:0px">
					<input id="id" type="hidden" name="id" value="${ep.project.id}">
					<input id="_m" type="hidden" name="_m" value="reportMsg">
					<textarea id="content" style="width: 415px;" rows="3" name="content"></textarea>
					<input id="btn" type="button" class="btn btn-primary" value="发布"> 
				</form>
			</div>


			<ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;margin-top:20px">
				<li class="active">
					<i class="icon-th"></i>信息流
				</li>
			</ul>
			<div class="wall">
				<ul>
					<c:if test="${fn:length(messageList) == 0 }">
						<blockquote>没有信息！</blockquote>
					</c:if>
					<li id="total" style="display:none">${fn:length(messageList)}</li>
					<c:forEach items="${messageList}" var="msg">
						<blockquote>${msg.content}</blockquote>
					</c:forEach>
				</ul>
			</div>



		</div>
		<div class="span3">
			<div class="box">
				<div class="head">我的任务</div>
				<ul>
					<c:if test="${fn:length(taskList) == 0 }">
						<li><a href=""></a>没有任务</li>
					</c:if>
					<c:forEach items="${taskList}" var="t">
						<li><a href="gogal.jspx?id=${t.gogalId}&_m=gotoTaskJsp">${t.name}(级别：${t.level})</a></li>
					</c:forEach>
				</ul>
			</div>
		</div>
	  </div>
	</div>
	<script type="text/javascript">
		$(document).ready(function(){
			var total = $("#total").text();
			var t = null;
			function getMsg() { 
				$.get("project.jspx?_m=getAddMsg&num="+total,function(data){
					$(data).each(function(){
						$("#total").after($("<blockquote>"+this.content+"</blockquote>)"));
						total++;
					});
				});
				t=setTimeout(getMsg, 3000);
			}
			getMsg();
			$("#btn").click(function(){
				var id = $("#id").val();
				var _m=$("#_m").val();
				var content=$("#content").val();
				if(content != "") {
					$("#content").val("");
					$.post("project.jspx",{"id":id,"_m":_m,"content":content},function(){
						clearTimeout(t);
						getMsg();
					});
				}
			});
		});
	</script>
</body></html>
